<!DOCTYPE html>
<html lang="en">

<head>
    <title>电子竞技</title>
    <meta charset="UTF-8">

    <meta name="viewport"
          content="width=device-width, initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
    <meta name="format-detection" content="telephone=no"/>
    <link href="../../css/public.css" rel="stylesheet">

    <style>
        .home_zhangdui_nav {
            overflow: hidden;
            background: #030e3d url('../../images/reg/back.png') 10px center no-repeat;
            border-bottom: 1px solid #24254E;
            background-size: 0.7rem;
        }

        .trad_contain {
            padding-top: 40px;
            background: #130235;
            padding-bottom: 9%;
        }

        .list {
            padding: 0 5px;
            padding: 0 .3rem;
            width: 90%;
            background: #1B1D5D;
            margin: auto;
            border-radius: 5px;
            margin-top: 20px;
        }

        .list > div {
            display: flex;
            font-size: .4rem;

        }

        .list > div div {
            flex: 2;
        }

        .list > div div:nth-child(1) {
            color: #BFC1F2;
        }

        .list > div div:nth-child(2) {
            flex: 1;
            text-align: center;

        }

        .overTrade {
            border-bottom: 1px solid #2A2B6B;
        }

        .list > div div:nth-child(3) {
            text-align: right;
        }

        .tradeType, .accountMoney {
            color: #FFCD29;
        }

        .accountMoney {
            font-size: .45rem;
        }

        .betMoney {
            color: #BFC1F2;
        }

        .time {
            font-size: .35rem;
            color: #7E85C2;
        }

        .tradState {
            color: #7E85C2;
        }

        .startTrad, .overTrade {

            height: 35px;
            line-height: 35px;
        }

        .account {
            height: 50px;
            line-height: 50px;
        }

        .tradeType img {
            width: .4rem
        }

        .tradStateNo {
            color: #bfc1f2;
            font-size: .45rem;
        }
    </style>
</head>

<body>

<body>
<div class="home_zhangdui_nav">
    <span class="goBack"></span>
    交易记录
</div>

<div class="trad_contain">
    <!-- <div class="list">
       <div class="startTrad">
            <div class="gameName">王者荣耀</div>
            <div class="tradeType"><img src="../../images/eSports/icon_up.png" alt=""> 买跌</div>
            <div class="time">2018/01/11   16:25:03</div>
       </div>
       <div class="overTrade">
            <div>321321231</div>
            <div class="betMoney">￥200</div>
            <div class="time">2018/01/11   16:25:20</div>
       </div>

       <div class="account">
            <div class="">321321231</div>
            <div class="accountMoney">+400</div>
            <div class="tradState">已结算</div>
       </div>
    </div> -->

    <!-- <div class="list">
            <div class="startTrad">
                 <div class="gameName">王者荣耀</div>
                 <div class="tradeType"><img src="../../images/eSports/icon_down.png" alt=""> 买跌</div>
                 <div class="time">2018/01/11   16:25:03</div>
            </div>
            <div class="overTrade">
                 <div>321321231</div>
                 <div class="betMoney">￥200</div>
                 <div class="time">2018/01/11   16:25:20</div>
            </div>

            <div class="account">
                 <div class="">321321231</div>
                 <div class="accountMoney">+500</div>
                 <div class="tradState">已结算</div>
            </div>
         </div> -->


</div>

<script src="../../js/jquery-3.2.1.min.js"></script>
<script src="../../js/public.js"></script>
<script>
    $(function () {
        $.post(gamingList, res => {
            console.log(res)
            let obj = res.obj,
                buy,
                jiesuan,
                result

            obj.forEach(item => {
                if (item.fdQuizNum == '02468') {
                    buy = '买双'
                }
                else if (item.fdQuizNum == '13579') {
                    buy = '买单'
                }
                else if (item.fdQuizNum == '56789') {
                    buy = '买大'
                }
                else if (item.fdQuizNum == '01234') {
                    buy = '买小'
                }
                else if (item.fdQuizNum == '0' && item.fdType == '3') {
                    buy = '买跌'
                }
                else if (item.fdQuizNum == '1' && item.fdType == '3') {
                    buy = '买涨'
                }
                else if (item.fdType == '2') {
                    buy = '特码'
                }
                if (item.fdResult == -1) {
                    result = '-'
                }
                else if (item.fdResult == 1) {
                    result = '+'
                }
                if (item.fdIsSettlement == 1) {
                    jiesuan = `
                <div class="list">
                    <div class="startTrad">
                         <div class="gameName">${item.fdGameName}</div>
                         <div class="tradeType"><img src="../../images/eSports/icon_down.png" alt=""> ${buy}</div>
                         <div class="time">${item.fdTime}</div>
                    </div>
                    <div class="overTrade">
                         <div>买入：${item.fdStartpoint}</div>
                         <div class="betMoney">￥${item.fdAmount}</div>
                         <div class="time"></div>
                    </div>
     
                    <div class="account">
                         <div class="">结果：${item.fdEndpoint}</div>
                         <div class="accountMoney" >${result}${item.fdMoney} </div>
                         <div class="tradState">已结算</div>
                    </div>
                 </div>`
                }
                else {
                    jiesuan = `
                <div class="list">
                    <div class="startTrad">
                         <div class="gameName">${item.fdGameName}</div>
                         <div class="tradeType"><img src="../../images/eSports/icon_down.png" alt=""> ${buy}</div>
                         <div class="time">${item.fdTime}</div>
                    </div>
                    <div class="overTrade">
                         <div>买入：${item.fdStartpoint}</div>
                         <div class="betMoney">￥${item.fdAmount}</div>
                         <div class="time"></div>
                    </div>
     
                    <div class="account">
                         <div class="" style="color: green">状态：${item.fdSecondResult == '0' ? '结算中' : item.fdSecondResult+'s后结算'}</div>
                         <div class="accountMoney"></div>
                         <div class="tradStateNo">未结算</div>
                    </div>
                 </div>`;
                    function formattertime(value){
                        if(value > 0){
                            var ret = setInterval(function(){--t.innerHTML;if(t.innerHTML==0){clearInterval(sa);}},1000);
                            return ret;
                        }else{
                            return 'over';
                        }
                    }
                }

                $('.trad_contain').append(jiesuan)
            });
        })
    })


</script>
</body>

</html>